#include "app_message.h"
#include "cJSON.h"

int main(int argc, char const *argv[])
{
    uint8_t  data[]={0x01,0x00,0x00,0x61,0x45,0x00,0x01 };
    char *json = app_message_charToJson(data, sizeof(data));

    log_info("json:%s", json);
    cJSON_free(json);


    char *json2 = "{\"device_id\":1,\"target_angle\": 3600, \"max_speed\": 60}";
    uint8_t buff[20] = {0};

    int data_len= app_message_jsonToChar(json2, buff, sizeof(buff));

    printf("data_len:%d  data: ", data_len);
    for(int i=0; i<data_len; i++)
    {
        printf("%02x ", buff[i]);
    }
    printf("\n");

    return 0;
}
